Skip to content

bugfix: Restore retail compatibility after retail behavior flags change#2727

Open
Caball009 wants to merge 3 commits into
TheSuperHackers:mainfrom
Caball009:fix_retail_behavior_flags
Open

bugfix: Restore retail compatibility after retail behavior flags change#2727
Caball009 wants to merge 3 commits into
TheSuperHackers:mainfrom
Caball009:fix_retail_behavior_flags

Conversation

@Caball009
Copy link
Copy Markdown

@Caball009 Caball009 commented May 17, 2026

#2691 Turned off some retail behavior which introduces mismatches. This PR aims to fix that.

TODO:

  • Replicate in Generals.
    Generals has one fewer change because this only exists in Zero Hour: RETAIL_COMPATIBLE_CRC || PRESERVE_STRUCTURE_STEALTH_DURING_REPAIR in StealthUpdate::allowedToStealth.

@Caball009 Caball009 added Bug Something is not working right, typically is user facing Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour ThisProject The issue was introduced by this project, or this task is specific to this project labels May 17, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 17, 2026

Greptile Summary

This PR restores retail-compatible behavior after PR #2691 disabled several PRESERVE_* flags, by adding RETAIL_COMPATIBLE_CRC as an OR-condition alongside the individual preserve flags so the retail code paths activate whenever RETAIL_COMPATIBLE_CRC is set (the default).

  • Tunnel heal stacking (TunnelTracker.h, TunnelTracker.cpp, TunnelContain.cpp, Player.cpp): Condition order is standardized to RETAIL_COMPATIBLE_CRC || PRESERVE_TUNNEL_HEAL_STACKING; negated guards are De Morgan–transformed to !(RETAIL_COMPATIBLE_CRC || PRESERVE_TUNNEL_HEAL_STACKING) — both are logically equivalent to the previous expressions.
  • Structure stealth during repair (ActiveBody.cpp, StealthUpdate.cpp): RETAIL_COMPATIBLE_CRC || is added to both the timestamp-recording site and the healing-exclusion guard, keeping the two sites in sync so the behavior is consistently gated.
  • Multi-crate pickup / poison & OCL XP (CrateCollide.cpp, PoisonedBehavior.cpp, ObjectCreationList.cpp): RETAIL_COMPATIBLE_CRC is added as an alternative enable condition (runtime expression or De Morgan transform) so retail defaults are preserved when the flag is set.

Confidence Score: 5/5

Safe to merge — all logic changes are either De Morgan–equivalent rewrites or symmetric paired additions of RETAIL_COMPATIBLE_CRC that restore the original retail behavior.

Every changed condition either reorders OR-operands (no semantic effect), applies a De Morgan transform to a negated conjunction (provably equivalent), or adds RETAIL_COMPATIBLE_CRC as a symmetric OR to a paired guard in both the write-site and the read-site (ActiveBody + StealthUpdate). No new logic paths are introduced, and the PRESERVE_* escape hatches remain intact for non-retail builds.

No files require special attention. The ActiveBody + StealthUpdate pair is the most nuanced change, but both sites are updated with the identical condition, keeping them in sync.

Important Files Changed

Filename Overview
GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h Condition order standardized to `RETAIL_COMPATIBLE_CRC
GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp Negated guard De Morgan–transformed to `!(RETAIL_COMPATIBLE_CRC
GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp Two condition sites standardized to `RETAIL_COMPATIBLE_CRC
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp Negated guard De Morgan–transformed to `!(RETAIL_COMPATIBLE_CRC
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp Adds `RETAIL_COMPATIBLE_CRC
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp Default value of m_allowMultiPickup now also enabled when RETAIL_COMPATIBLE_CRC is set, restoring retail multi-crate pickup behavior.
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp Condition order standardized — no semantic change.
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp Negated guard De Morgan–transformed to `!(RETAIL_COMPATIBLE_CRC
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp Adds `RETAIL_COMPATIBLE_CRC

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[RETAIL_COMPATIBLE_CRC default=1] --> B{Retail behavior active?}
    C[PRESERVE_* flags] --> B

    B -->|RETAIL_COMPATIBLE_CRC=1 OR PRESERVE_*=1| D[Retail code paths enabled]
    B -->|Both 0| E[Bug-fixed code paths enabled]

    D --> F1[Tunnel heal stacking\nTunnelTracker / TunnelContain / Player]
    D --> F2[Structure stealth during repair\nActiveBody + StealthUpdate]
    D --> F3[Multi-crate pickup default on\nCrateCollide]
    D --> F4[No XP from poison/OCL kills\nPoisonedBehavior / ObjectCreationList]

    E --> G1[Single heal per frame]
    E --> G2[Stealth suppressed during repair]
    E --> G3[Multi-crate pickup default off]
    E --> G4[XP awarded from poison/OCL kills]
Loading

Reviews (3): Last reviewed commit: "Changed macro order & macro expressions." | Re-trigger Greptile

Comment thread Core/GameEngine/Include/Common/GameDefines.h Outdated
Comment thread Core/GameEngine/Include/Common/GameDefines.h Outdated
Copy link
Copy Markdown

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do add the overall preserve retail flag pattern, it might be better to split out the custom configuration into a cmake file for the pre configured flags that we are setting.

Comment thread Core/GameEngine/Include/Common/GameDefines.h Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp Outdated
Comment thread Core/GameEngine/Include/Common/GameDefines.h Outdated
@Caball009 Caball009 force-pushed the fix_retail_behavior_flags branch from d48d2c9 to 9ec6877 Compare May 19, 2026 13:17
@Caball009
Copy link
Copy Markdown
Author

Caball009 commented May 19, 2026

Every use of a PRESERVE_ macro (except PRESERVE_RETAIL_SCRIPTED_CAMERA) is now preceded by a RETAIL_COMPATIBLE_CRC macro.

@githubawn
Copy link
Copy Markdown

Copy link
Copy Markdown

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@Caball009
Copy link
Copy Markdown
Author

Replicated in Generals.

Generals has one fewer change because this only exists in Zero Hour: RETAIL_COMPATIBLE_CRC || PRESERVE_STRUCTURE_STEALTH_DURING_REPAIR in StealthUpdate::allowedToStealth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ThisProject The issue was introduced by this project, or this task is specific to this project ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants